package Collection;

import java.util.*;

public class SortString {
    public static void main(String[] args) {
        List<String>list=new ArrayList<>();
        list.add("qwq");
        list.add("ovo");
        list.add("tvt");
        System.out.println("list:"+list);

        Collections.sort(list, new Comparator<String>() {
            public int compare(String o1, String o2) {
                return o1.length()-o2.length();
            }
        });

        Collections.sort(list,(o1, o2) -> o1.length()-o2.length());
        System.out.println(list);






        /*
        list.add("tom");
        list.add("Bob");
        list.add("jerry");
        list.add("black");
        list.add("Rose");
        list.add("jack");
        System.out.println("lisr原始数据："+list);
         */
    }
}
